import BaseCreatejs from '@/components/games/createjs/js/BaseCreatejs'

export default class SlideZipper extends BaseCreatejs {
  constructor() {
    super();
    //子类覆盖

    this.startX = 0;
    this.startY = 0;

    this.endX = 0;
    this.endY = 0;
  }

  initView() {
    this.container.addEventListener("mousedown", this.startMove);
  }

  startMove(e) {
    this.startX = e.stageX;
    this.startY = e.stageY;

    this.container.addEventListener("stagemousemove", (e) => {
      // this.endX = e.stageX;
      // this.endY = e.stageY;

      // this.computeDistance();
    });
    this.container.addEventListener("stagemouseup", (e) => {
      this.container.removeEventListener("mousedown", this.startMove);

      this.endX = e.stageX;
      this.endY = e.stageY;

      this.computeDistance();
    });
  }

  computeDistance(){
    if(this.endY - this.startY > 50){
      //播放 拉链动画
    }
  }

  startMC(){
    // 拉动拉链到最后播放门动画

    // 打开门 左右移动门
  }

  destroy() {
    //子类覆盖

    this.stage = null;
		this.item = null;
		this.commonAttr = null;
		this.store = null;
		this.mcCallback = null;
  }
}
